package cn.mccraft.uide.core.ui.control.skin;

import cn.mccraft.uide.core.ui.control.StatusBarItem;
import javafx.scene.Node;
import javafx.scene.control.SkinBase;

public class StatusBarItemSkin extends SkinBase<StatusBarItem> {

	public StatusBarItemSkin(StatusBarItem control) {
		super(control);
		init();
	}
	
	private void init() {
		Node content = getSkinnable().getContent();
		if(content != null)
			getChildren().add(content);
		getSkinnable().contentProperty().addListener((observable,oldValue,newValue)->{
			if(oldValue != null)
				getChildren().remove(oldValue);
			if(newValue != null)
				getChildren().add(newValue);
		});
	}
	
	@Override
	protected void layoutChildren(double contentX, double contentY, double contentWidth, double contentHeight) {
		getSkinnable().getContent();
	}

}
